
import { getShareAppMessage } from '@/utils/share'
const state = {
  data: getShareAppMessage(),
  appMessage: null
}

const mutations = {
  SET_SHARE_DATA: (state, data) => {
    console.log('SET_SHARE_DATA ing...')
    state.data = data
  }
}

const actions = {
  // 设置分享数据
  setData ({ commit }, data) {
    return new Promise((resolve, reject) => {
      if (state.connect) {
        commit('SET_SHARE_DATA', data)
        resolve(data)
      } else {
        reject(data)
      }
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
